> ## Documentation Index
> Fetch the complete documentation index at: https://edimez14-password_generator.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# List Saved Passwords

Retrieves all passwords saved by the authenticated user.

## Endpoint

```
GET /api/password-generator/view-all-saved-passwords/
```

## Authentication

**Authorization** `string` *required*

Bearer token for authentication. User must be logged in.

## Request

This endpoint does not accept any parameters. It automatically filters passwords for the authenticated user.

## Response

**message** `string` *required*

A message indicating the user whose passwords are being retrieved.

**passwords** `array` *required*

Array of saved password objects.

**Password Object**

**id** `integer`

Unique identifier for the saved password.

**name\_pages** `string`

Friendly name for the page or service.

**url** `string`

The URL where this password is used.

**password\_saved** `string`

The saved password.

**user** `integer`

The user ID who owns this password.

### Success Response

```json 200 OK theme={null}
{
  "message": "Passwords saved by the user john_doe: ",
  "passwords": [
    {
      "id": 1,
      "name_pages": "Example Website",
      "url": "https://example.com",
      "password_saved": "MySecureP@ss123",
      "user": 1
    },
    {
      "id": 2,
      "name_pages": "Test Site",
      "url": "https://test.com",
      "password_saved": "AnotherP@ss456",
      "user": 1
    }
  ]
}
```

### Error Responses

```json 400 Bad Request theme={null}
{
  "error": "Missing required fields."
}
```

```json 404 Not Found theme={null}
{
  "error": "password does not exist after creation."
}
```

```json 500 Internal Server Error theme={null}
{
  "error": "error message"
}
```

## Example Request

```bash cURL theme={null}
curl -X GET https://api.example.com/api/password-generator/view-all-saved-passwords/ \
  -H "Authorization: Bearer YOUR_TOKEN"
```

```javascript JavaScript theme={null}
fetch('https://api.example.com/api/password-generator/view-all-saved-passwords/', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN'
  }
})
.then(response => response.json())
.then(data => console.log(data.passwords));
```

```python Python theme={null}
import requests

headers = {
    'Authorization': 'Bearer YOUR_TOKEN'
}

response = requests.get(
    'https://api.example.com/api/password-generator/view-all-saved-passwords/',
    headers=headers
)
data = response.json()
print(data['passwords'])
```

## Implementation Details

This endpoint is implemented in `views.py:64` using the `view_all_saved_passwords` view function. It filters the SavedPasswords model by the authenticated user and serializes the results using `SavedPasswordsSerializer`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.